//
//  ShareTool.m
//  GolfButler
//
//  Created by xMini on 15/11/19.
//  Copyright © 2015年 Aorunde. All rights reserved.
//

#import "ShareTool.h"

@implementation ShareTool

+(void)shareWithTitle:(NSString *)title images:(NSArray *)imgArr url:(NSString *)url content:content type:(NSInteger)type {
    if (imgArr) {
        NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];
        [shareParams SSDKSetupShareParamsByText:content images:imgArr url:[NSURL URLWithString:url] title:title type:SSDKContentTypeAuto];
//        [shareParams SSDKEnableUseClientShare];
        [ShareSDK share:type parameters:shareParams onStateChanged:^(SSDKResponseState state, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error) {
            switch (state) {
                case SSDKResponseStateSuccess:
                    /// 成功

                    break;
                case SSDKResponseStateFail:
                    /// 失败

                    break;
                case SSDKResponseStateCancel:
                    /// 取消

                    break;
                default:
                    break;
            }
        }];
//        // 分享
//        [ShareSDK share:type parameters:shareParams onStateChanged:^(SSDKResponseState state, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error) {
//            switch (state) {
//                case SSDKResponseStateSuccess:
//                    /// 成功
//
//                    break;
//                case SSDKResponseStateFail:
//                    /// 失败
//
//                    break;
//                case SSDKResponseStateCancel:
//                    /// 取消
//
//                    break;
//                default:
//                    break;
//            }
//        }];
    }
}

- (void)sendImageContent:(NSInteger)sessionType
{
   
}

+(void)shareXCXWithTitle:(NSString *)title content:(NSString *)content imageData:(NSData *)imageData url:(NSString *)url path:(NSString *)path{
//    WXMiniProgramObject *object = [WXMiniProgramObject object];
//    object.webpageUrl = url;
//    object.userName = @"gh_b97ccc83d670";
//    object.path = path;
//    object.hdImageData = imageData;
////    object.withShareTicket = withShareTicket;
//    object.miniProgramType = WXMiniProgramTypeRelease;
//
//    WXMediaMessage *message = [WXMediaMessage message];
//    message.title = title;
//    message.description = content;
//    message.thumbData = imageData;  //兼容旧版本节点的图片，小于32KB，新版本优先
//    //使用WXMiniProgramObject的hdImageData属性
//    message.mediaObject = object;
//
//    SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
//    req.bText = NO;
//    req.message = message;
//    req.scene = WXSceneSession;  //目前只支持会话
////    BOOL isOpen = [WXApi sendReq:req];
//    [WXApi sendReq:req completion:^(BOOL success) {
//        if (!success) {
//            DLOG(@"跳转失败");
//        }
//    }];
//    if (!isOpen) {
//        DLOG(@"打开失败");
//    }
}

@end
